import Vue from "vue";
import Router from "vue-router";
import Home from "@/pages/layout/home";
import Pay from "@/pages/layout/payPage";

// 发现
const FindPage = resolve => require(["@/pages/findPage"], resolve);
// 学习
const LearnPage = resolve => require(["@/pages/study/learnPage"], resolve);
// 我的
const MinePage = resolve => require(["@/pages/mine/minePage"], resolve);
// 详情页
const Details = resolve => require(["@/pages/details"], resolve);

// 详情页跳转页
const DetailsCenter = resolve => require(["@/pages/detailsCenter"], resolve);

// 单元详情页
const UnitDetail = resolve => require(["@/pages/unitDetail"], resolve);
// 收藏列表
const Collection = resolve => require(["@/pages/collection"], resolve);
// 关注
const FollowPage = resolve => require(["@/pages/followPage"], resolve);
// 卡劵
const Coupon = resolve => require(["@/pages/coupon"], resolve);
// 入住
const CheckIn = resolve => require(["@/pages/checkIn"], resolve);
// 入住下一步
const CheckInNext = resolve => require(["@/pages/checkInNext"], resolve);
// 订单列表
const OrderList = resolve => require(["@/pages/mine/orderList"], resolve);
// 推广赚钱
const Spread = resolve => require(["@/pages/spread"], resolve);
// 提现页面
const CashOut = resolve => require(["@/pages/cashOut"], resolve);

// 付费界面

// 今日
const PayToday = resolve => require(["@/pages/payPage/payToday"], resolve);
// 教务
const PayEducational = resolve =>
  require(["@/pages/payPage/payEducational"], resolve);
// 教务
const PayMine = resolve => require(["@/pages/payPage/payMine"], resolve);

// 章节阅读页面
const PayRead = resolve => require(["@/pages/payPage/payRead"], resolve);
// 打卡日历
const PayClockDate = resolve =>
  require(["@/pages/payPage/payClockDate"], resolve);
// 学分
const PayCredit = resolve => require(["@/pages/payPage/payCredit"], resolve);

Vue.use(Router);

export default new Router({
  routes: [
    {
      path: "/",
      redirect: "/findPage",
      component: Home,
      children: [
        {
          // 发现
          path: "/findPage",
          name: "发现",
          component: FindPage
        },
        {
          path: "/learnPage",
          name: "学习",
          component: LearnPage
        },
        {
          path: "/minePage",
          name: "我的",
          component: MinePage
        }
      ]
    },
    {
      path: "/details",
      name: "详情",
      component: Details
    },
    {
      path: "/detailsCenter",
      name: "详情中转",
      component: DetailsCenter
    },
    {
      path: "/unitDetail",
      name: "单元详情",
      component: UnitDetail
    },
    {
      path: "/projectList",
      name: "产品列表",
      component: resolve => require(["@/pages/project/projectList"], resolve)
    },
    {
      path: "/collection",
      name: "收藏列表",
      component: Collection
    },
    {
      path: "/followPage",
      name: "关注",
      component: FollowPage
    },
    {
      path: "/coupon",
      name: "卡券",
      component: Coupon
    },
    {
      path: "/checkIn",
      name: "入住",
      component: CheckIn
    },
    {
      path: "/checkInNext",
      name: "入住下一步",
      component: CheckInNext
    },
    {
      path: "/orderList",
      name: "订单记录",
      component: OrderList
    },
    {
      path: "/spread",
      name: "推广赚钱",
      component: Spread
    },
    {
      path: "/generalize",
      name: "推广赚钱",
      component: resolve => require(["@/pages/mine/generalize"], resolve)
    },

    {
      path: "/QA",
      name: "常见问题",
      component: resolve => require(["@/pages/mine/QA"], resolve)
    },
    {
      path: "/contactUs",
      name: "联系客服",
      component: resolve => require(["@/pages/mine/contactUs"], resolve)
    },

    {
      path: "/cashOut",
      name: "提现",
      component: CashOut
    },
    {
      path: "/pay",
      redirect: "/payToday",
      component: Pay,
      children: [
        {
          path: "/payToday",
          name: "今日",
          component: PayToday
        },
        {
          path: "/payEducational",
          name: "教务",
          component: PayEducational
        },
        {
          path: "/payMine",
          name: "支付我的",
          component: PayMine
        }
      ]
    },
    {
      path: "/payRead",
      name: "阅读",
      component: PayRead
    },
    {
      path: "/payReadContent",
      name: "阅读内容",
      component: resolve => require(["@/pages/payPage/payReadContent"], resolve)
    },
    {
      path: "/payPlanPage",
      name: "阅读计划",
      component: resolve => require(["@/pages/payPage/payPlanPage"], resolve)
    },

    {
      path: "/payClockDate",
      name: "打卡日历",
      component: PayClockDate
    },
    {
      path: "/payCredit",
      name: "学分",
      component: PayCredit
    },
    {
      path: "/studyPlan",
      name: "学习计划",
      component: resolve => require(["@/pages/payPage/studyPlan"], resolve)
    },
    {
      path: "/handbook",
      name: "学习手册",
      component: resolve => require(["@/pages/mine/handbook"], resolve)
    },
    {
      path: "/power",
      name: "加入悦睿",
      component: resolve => require(["@/pages/mine/power"], resolve)
    },

    {
      path: "/pushInfo",
      name: "推送信息",
      component: resolve => require(["@/pages/pushInfo"], resolve)
    }
  ]
});
